﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Announcement
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["UserName"] != null)
                {
                    Response.Redirect("ApplyList.aspx");
                }
                if (Session["AdminUserName"] != null)
                {
                    Response.Redirect("Admin/ApplyMgr.aspx");
                }
            }
        }

        protected void LoginButton_Click(object sender, EventArgs e)
        {
            string userName = txtUserName.Text;
            string password = txtPassword.Text;
            if (userName == "admin" && password == "admin")
            {
                Session.Add("AdminUserName", "admin");
                Response.Redirect("Admin/ApplyMgr.aspx");
            }
            if (userName == "lzfcjys" && password == "123")
            {
                Session.Add("UserName", "lzfcjys");
                Response.Redirect("ApplyList.aspx");
            }
            lErrorMsg.Text = "用户名密码错误";
            divError.Visible = true;
            
        }
    }
}
